<?php

$dbcon = mysql_connect( MYSQL_SERVER, MYSQL_USERNAME, MYSQL_PASSWORD );
if ( !$dbcon )
	exit;

mysql_select_db( MYSQL_DATABASE ) or die( mysql_error() );

class Sql
{
	public $queries = 0;
	public $data;
	
	public function query( $query )
	{
		$this->data = mysql_query( $query ) or die( mysql_error() );
		$this->queries++;
		return $this->data;
	}

	public function select_strings( $id )
	{
		$query = "SELECT * FROM `data`
					WHERE `id` = " . $id . "
					LIMIT 0, 1";
		
		return $this->query( $query );
	}

	public function insert_strings( $strings, $default )
	{
		$query = "INSERT INTO `data` (
						`strings`,
						`default` )
					VALUES (
						'" . $strings . "',
						'" . $default . "' )";

		return $this->query( $query );
	}

	public function update_strings( $id, $strings )
	{
		$query = "UPDATE `data`
					SET `strings` = '" . $strings ."'
					WHERE `id` = " . $id . "
					LIMIT 1";
		
		return $this->query( $query );
	}
}

?>